CSharpTest.Net
MD5(Byte[]) Method
See Also  Example Send Feedback Download Help File
CSharpTest.Net.Library Assembly > CSharpTest.Net.Crypto Namespace > Hash Class > MD5 Method : MD5(Byte[]) Method

bytes

Glossary Item Box

Computes an MD5 hash

Syntax

Visual Basic (Declaration) 
Public Overloads Shared Function MD5( _
   ByVal bytes() As Byte _
) As Hash
C# 
public static Hash MD5( 
   byte[] bytes
)

Parameters

bytes

Example

Library/Library.Test/TestHash.cs

C#Copy Code
Hash hash = Hash.MD5(TestData);
Assert.AreEqual(MD5.Create().ComputeHash(TestData), hash.ToArray());
Hash hash2 = Hash.MD5(TestDataStream());

Assert.AreEqual(hash, hash2);
Assert.IsTrue(hash == hash2);
Assert.IsTrue(hash.Equals(hash2));
Assert.IsTrue(hash.Equals((object)hash2));
Assert.AreEqual(hash.GetHashCode(), hash2.GetHashCode());
Assert.AreEqual(hash.Length, hash2.Length);
Assert.AreEqual(hash.ToString(), hash2.ToString());
Assert.AreEqual(hash.ToArray(), hash2.ToArray());
Assert.IsFalse(hash != hash2);
VB.NETCopy Code
Dim hash As Hash = Hash.MD5(TestData)
Assert.AreEqual(MD5.Create().ComputeHash(TestData), hash.ToArray())
Dim hash2 As Hash = Hash.MD5(TestDataStream())

Assert.AreEqual(hash, hash2)
Assert.IsTrue(hash = hash2)
Assert.IsTrue(hash.Equals(hash2))
Assert.IsTrue(hash.Equals(DirectCast(hash2, Object)))
Assert.AreEqual(hash.GetHashCode(), hash2.GetHashCode())
Assert.AreEqual(hash.Length, hash2.Length)
Assert.AreEqual(hash.ToString(), hash2.ToString())
Assert.AreEqual(hash.ToArray(), hash2.ToArray())
Assert.IsFalse(hash <> hash2)

Requirements

Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7

See Also

Generated with Document! X 2011 by Innovasys